package com.txtsqlclient.ui.si;

import com.txtsqlclient.ui.exception.SubInterfaceException;
import com.txtsqlclient.ui.factory.SubInterfaceFactory;
import com.txtsqlclient.ui.vo.Session;

/**
 * @author spadda
 * 
 */
public abstract class PromptBasedSubInterface implements SubInterface,
		InputGatherer, InputHandler {

	protected SubInterfaceFactory getSubInterfaceFactory() {
		return SubInterfaceFactory.getInstance();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.txtsqlclient.ui.SubInterface#process(com.txtsqlclient.ui.Session)
	 */
	public void process(final Session session) throws SubInterfaceException {
		try {
			gatherInput(session);
			handleInput(session);
		} catch (SubInterfaceException se) {
			throw se;
		} catch (Exception e) {
			throw new SubInterfaceException(
					"An error occured while processing the request", e);
		}
	}

}